//* static alien that rotate and shoots shrapnels directly to the ship

alien_cannon_images = new Images('cannon',1);

function AlienCannon() {
  // contructor
  var that = new Alien();
  that.images = alien_cannon_images;
  that.credit = 220;
  that.angle = 0;
  
  // update 
  that.update = function() {
    // fire every once in a while
    this.angle = Math.atan2(ship.y-this.y,ship.x-this.x);
    if (this.frame % 50 == 49) {
      var s = AlienShrapnels(1,this.x,this.y);
      s[0].dx = 10*Math.cos(this.angle);
      s[0].dy = 10*Math.sin(this.angle); 
      aliens.add(s);
    }
  }
  
  return that;
}

function AlienCannons(ACount) {
  // create array of aliens
  var that = new Array();
  for (var i=0; i<ACount; i++)
      that.push(new AlienCannon());
  return that;  
}
